#pragma once

/*----------------------------------------------------------------------------*/
class CNeuronBase
{
/*----------------------------------------------------------------------------*/

public:

/*----------------------------------------------------------------------------*/

	CNeuronBase( int _inputsNum );

	CNeuronBase( std::ifstream& _file );

	virtual ~CNeuronBase();

/*----------------------------------------------------------------------------*/
	
	virtual void CalcLocalError( double ) = 0;

	double CalculateOutputValue( const DoubleV& _inputValues );
	
	double GetWeightedError( int _weightNum );

	void CalcNewWeights( double _speed, const DoubleV& _inputValues );

	void SaveToFile( std::ofstream& _file );
	
	// temp
	void PrintWeights();
	void PrintResValue();
	void PrintError();
	void PrintWeError();

/*----------------------------------------------------------------------------*/
	
protected:

/*----------------------------------------------------------------------------*/

	double  m_resValue;	
	double  m_localError;
	DoubleV m_weights;
	DoubleV m_weightedError;

/*----------------------------------------------------------------------------*/

	void    InitWeights();

	void    CalcWeightedErrors();

	double  ActivationFunc( double _value );

/*----------------------------------------------------------------------------*/

};

/*----------------------------------------------------------------------------*/

class CNeuron
	:	public CNeuronBase
{
/*----------------------------------------------------------------------------*/

public:

/*----------------------------------------------------------------------------*/

	CNeuron( int _inputsNum );

	CNeuron( std::ifstream& _file );

	virtual void CalcLocalError( double _backError );

/*----------------------------------------------------------------------------*/

};

/*----------------------------------------------------------------------------*/

class CNeuronLast
	:	public CNeuronBase
{
/*----------------------------------------------------------------------------*/

public:

/*----------------------------------------------------------------------------*/

	CNeuronLast( int _inputsNum );

	CNeuronLast( std::ifstream& _file );

	virtual void CalcLocalError( double _desiredResult );

/*----------------------------------------------------------------------------*/

};

/*----------------------------------------------------------------------------*/
